package com.bs.bszhsq.mapper;

import com.bs.bszhsq.entity.Carport;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bs.bszhsq.entity.EchartsCar;
import com.bs.bszhsq.entity.EchartsCarNum;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 车位信息 Mapper 接口
 * </p>
 *
 * @author 章宇光
 * @since 2024-03-25
 */
public interface CarportMapper extends BaseMapper<Carport> {

    @Select("select COUNT(*) as value,type as name from carport group by type")
    List<EchartsCarNum> getCars();
    @Select("select COUNT(*) as value,type as name from carport where status='1' group by type")
    List<EchartsCarNum> getEchartsCar();
    @Update("update carport set status='0' and user_id=null and start_end=null where id=#{id}")
    Boolean updateCar(Long id);
}
